package cn.edu.nhic.nhcarsb.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel(value = "响应结果")
public class R {
    @ApiModelProperty(value = "响应码{200：成功；500：失败}")
    private int code;
    @ApiModelProperty(value = "响应信息")
    private String msg;
    @ApiModelProperty(value = "响应数据")
    private Object data;

    public static R success(Object data) {
        R r = new R();
        r.setCode(200);
        r.setData(data);
        return r;
    }

    public static R error(String msg) {
        R r = new R();
        r.setCode(500);
        r.setMsg(msg);
        return r;
    }
}
